import request from '@/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/blade-iot/category/version/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/blade-iot/category/version/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/blade-iot/category/version/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/blade-iot/category/version/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/blade-iot/category/version/submit',
    method: 'post',
    data: row
  })
}

export const select = (categoryId) => {
  return request({
    url: '/blade-iot/category/version/select',
    method: 'get',
    params: {
      categoryId
    }
  })
}

export const dataPublishedTsl = (categoryId) => {
  return request({
    url: '/blade-iot/category/version/data-published-tsl',
    method: 'get',
    params: {
      categoryId,
    }
  })
}

export const dataDraftedTsl = (categoryId) => {
  return request({
    url: '/blade-iot/category/version/data-drafted-tsl',
    method: 'get',
    params: {
      categoryId,
    }
  })
}

export const dataPublished = (categoryId) => {
  return request({
    url: '/blade-iot/category/version/data-published',
    method: 'get',
    params: {
      categoryId
    }
  })
}

export const dataSnapshot = (versionId) => {
  return request({
    url: '/blade-iot/category/version/data-snapshot',
    method: 'get',
    params: {
      versionId
    }
  })
}

export const dataRecovery = (versionId) => {
  return request({
    url: '/blade-iot/category/version/data-recovery',
    method: 'post',
    params: {
      versionId
    }
  })
}

export const dataImport = (versionId, categoryId) => {
  return request({
    url: '/blade-iot/category/version/data-import',
    method: 'post',
    params: {
      versionId,
      categoryId
    }
  })
}
